package com.fangyang.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.fangyang.dao.UserRepository;
import com.fangyang.domain.User;
import com.fangyang.service.UserServcie;

@Service
@Transactional
public class UserServiceImpl implements UserServcie {

    @Autowired
    private UserRepository userRepository;

    @Override
    public List<User> findAll() {
        List<User> list = userRepository.findAll();
        return list;
    }

    @Override
    public User findById(Integer id) {
        User user = userRepository.findOne(id);
        return user;
    }

    @Override
    public User findByUsernameAndPassword(String username, String password) {
        User user = userRepository.findByUsernameAndPassword(username, password);
        return user;
    }

}
